<template>
	<view class="content">
		<uni-list>
			<!-- <uni-list-item v-for="(Record,index) in RecordList" thumb="../../static/logo.png" :key="index" clickable :to="'./RecordDetail?id='+Record.ID"
			 :time="Record.StartTime" badge-positon="left" badge-text="dot" :note="Record.Category" :title="Record.Theme">
			</uni-list-item> -->
			<uni-list-item :to="'./RecordDetail?id=' + Record.ID" v-for="(Record, index) in RecordList" :key="index"
				direction="column" :note="Record.Category + '  ' + Record.StartTime">
				<template v-slot:header>
					<view class="uni-title">{{ Record.Theme }}
						<span v-if="Record.Duration">({{ Record.Duration }}分钟)</span>

					</view>
					<view class="uni-thumb uni-content list-picture">
						<image :src="Record.ImageUrl || ''" mode="aspectFill"></image>
					</view>
				</template>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import {
		mapActions,
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				RecordList: []
			};
		},
		onShow() {
			uni.setNavigationBarTitle({
				title: '之江党支部-活动'
			})
		},
		computed: {
			...mapState(['token', 'userCode'])
		},
		methods: {
			...mapActions(['reLogin', 'getToken', 'hasLogin']),

			getRecord() {
				uni.showLoading()
				// console.log(this.token,this.userCode);
				let url = {
					url: '/api/GetRecordList'
				}
				let param = {
					userCode: this.userCode,
					token: this.token
				}
				this.$request.httpRequest(url, param).then(e => {
					if (!e.data.Success) {
						console.log('登录失效');
						this.reLogin();
					}
					// console.log(e.data);
					this.RecordList = e.data.items;
					uni.hideLoading()
				})
			}
		},
		activated() {
			this.hasLogin();
			this.getRecord();
		},
		onLoad() {
			this.hasLogin();
			this.getRecord();
		}
	};
</script>

<style lang="scss" scoped>
	@import '@/common/uni-ui.scss';

	.tips {
		color: #67c23a;
		font-size: 14px;
		line-height: 40px;
		text-align: center;
		background-color: #f0f9eb;
		height: 0;
		opacity: 0;
		transform: translateY(-100%);
		transition: all 0.3s;
	}

	.list-picture {
		width: 100%;
		height: 145px;
	}

	.thumb-image {
		width: 100%;
		height: 100%;
	}
</style>
